# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .models import licence
import os
import xadmin
import commands


class sysrestartAdmin(object):
    list_display = []
    object_list_template = "sysrestart.html"

    def post(self, request, *args, **kwargs):
        a = commands.getoutput("systemctl restart freeswitch.service")
        print "sysrestartAdmin:"+a
        if a=="":
            self.message_user(u'重启成功!', 'success')
        else:
            self.message_user(a, 'success')
        return super(sysrestartAdmin, self).post(request, args, kwargs)